<!DOCTYPE html>
<html lang="en" 
      xmlns="http://www.w3.org/1999/xhtml"
      xmlns:jsf="http://xmlns.jcp.org/jsf"
      xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
      xmlns:f="http://xmlns.jcp.org/jsf/core"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      >
    <h:head>
        <title>JSF 2.3: Websocket Sample</title>
    </h:head>
    <h:body>
        <h1>JSF 2.3: f:validateWholeBean Example </h1>
        <hr />
        <h:panelGroup id="messageFromInputBox">
            <h:messages />
        </h:panelGroup>
        <h:form>
        <h:panelGrid columns="2">

            <h:outputText value="Password" />  
            <h:inputSecret id="password1" value='#{backingBean.password1}' required="true">
                <f:validateBean validationGroups="javax.validation.groups.Default,com.hantsylabs.example.ee8.jsf.PasswordValidationGroup" />
            </h:inputSecret>

            <h:outputText value="Password again" /> 
            <h:inputSecret id="password2" value='#{backingBean.password2}' rendered="true">
                <f:validateBean validationGroups="javax.validation.groups.Default,com.hantsylabs.example.ee8.jsf.PasswordValidationGroup" />
            </h:inputSecret>

        </h:panelGrid>

        <f:validateWholeBean value='#{backingBean}' 
                             validationGroups="com.hantsylabs.example.ee8.jsf.PasswordValidationGroup" />
        <div>
            <h:commandButton 
                id="validtePassword" 
                value="Validate Password">
                <f:ajax execute="@form" render=":messageFromInputBox" />
            </h:commandButton>
        </div>
        </h:form>

    </h:body> 
</html>